package demo.spring.batis.service;

import java.util.List;
import demo.spring.batis.dao.DemoDao;
import demo.spring.batis.model.UserModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by Qian on 2017/3/2.
 */
@Service
public class DemoService {
    @Autowired
    private DemoDao demoDao;
    @Transactional
    public void add(UserModel userModel) {
        demoDao.add(userModel);
    }

    public void delete(String name) {
        demoDao.delete(name);
    }

    public void update(UserModel userModel) {
        demoDao.update(userModel);
    }

    public List<UserModel> getAll() {
        return demoDao.getAll();
    }

    public List<UserModel> select(String name) {
        return demoDao.select(name);
    }
}
